<!--
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
-->
<template>
  <el-dialog v-model="props.uploadCaculateVisible" title="算例文档上传" width="500" destroy-on-close :before-close="handleVisible">
    <el-upload
      ref="upload"
      class="upload-demo"
      action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
      :limit="1"
      :auto-upload="false"
    >
      <template #trigger>
        <el-button type="primary" icon="UploadFilled">添加文件</el-button>
      </template>
      <template #tip>
        <div class="text-red">提示：点击确定按钮后新文件将覆盖旧文件</div>
      </template>
    </el-upload>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="handleVisible">取消</el-button>
        <el-button type="primary" @click="submitAdd"> 确认 </el-button>
      </div>
    </template>
  </el-dialog>
</template>
  
  <script name="UploadCaculateDoc" setup>
const props = defineProps(['uploadCaculateVisible', 'rowData']);
const emit = defineEmits(['close']);
// 通知父组件
const handleVisible = (modalType) => {
    emit('close', { type: 'caculateUpload', data: { type: modalType === 'refesh' ? 'refesh' : '' } });
};
// 提交数据
const submitAdd = () => {
    handleVisible('refesh')
};
</script>
<style scoped>
.text-red{
    color: red;
    margin-top: 10px;
}
:deep(.el-cascader) {
  width: 100%;
}
</style>